import 'package:animal/network/api.dart';
import 'package:animal/ui/login/NWApi.dart';
import 'package:animal/utils/RuleUtils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';

class SetPwdController extends GetxController{
  //密码
  TextEditingController pwdController = TextEditingController();

  RxString errText = "".obs;

  //是否密文显示
  RxBool obscure = true.obs;

  FocusNode userFocusNode = FocusNode();


  ///设置密码
  void setPwd(){
    userFocusNode.unfocus();
    if(RuleUtils().checkStringRule(RuleType.chinese, pwdController.text, null) != null){
      SmartDialog.showToast("密码中不能包含有汉字");
      return;
    }
    if(pwdController.text.isEmpty){
      SmartDialog.showToast("密码不能为空");
      return;
    }
    var putData = {"pwd":pwdController.text};
    HttpManager().post(NWApi.userSetLoginPwd,queryParameters: putData).listen((value) {

    },onError: (err){
      debugPrint(err.message);
    });
  }
}